package com.geekhome.znxz.cucumber.chapter1;

import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import org.junit.Assert;

/**
 * Copyright © 2019年 znxz. All rights reserved.
 *
 * @author 临江仙 hzqiuxm@163.com
 * 参数测试
 * @date 2019/5/23 9:44
 */
public class ArgumentsStepdefs {

    private String name;
    private int age;
    private String result;


    @Given("^the name is \"([^\"]*)\" and age is (\\d+)$")
    public void theNameIsAndAgeIs(String name, int age) throws Throwable {
        // Write code here that turns the phrase above into concrete actions
        this.name = name;
        this.age = age;
    }

    @When("^format the input$")
    public void formatTheInput() throws Throwable {
        // Write code here that turns the phrase above into concrete actions
        this.result = name + "-" + age;
        System.out.println("format the input");
    }

    @Then("^the format string is \"([^\"]*)\"$")
    public void theFormatStringIs(String value) throws Throwable {
        // Write code here that turns the phrase above into concrete actions
        Assert.assertEquals(value,result);
    }
}
